#ifndef MUNDO_H
#define MUNDO_H

#include "OgreBox.h"
#include <map>
using namespace std;

class Mundo {
	
	public:
	b2World * mundo;
	SceneManager * mSceneMgr;
	map<String, OgreBox> objetos;

	Mundo(SceneManager * scnmgr)
	{
		timeStep = 1.0f / 60.0f;
		iterations = 10;
		mSceneMgr = scnmgr;
		
		b2AABB caja;
		b2Vec2 gravedad;		
		caja.lowerBound.Set(-100.0f, -100.0f);
		caja.upperBound.Set(100.0f, 100.0f);
		gravedad = b2Vec2(0.0f, -10.0f);

		mundo = new b2World(caja, gravedad, true);
		
	}

	void step(){ step(timeStep); };
	void step(Real timeStep) { 

		mundo->Step(timeStep, iterations); 			
		map<String, OgreBox>::iterator obj;			
		for ( obj = objetos.begin(); obj != objetos.end(); obj++ ) {
			obj->second.update();
		}
	};
		
	private:
	float32 timeStep; 
	int32 iterations;
};


#endif;